<?php
require "/var/www/html/Sign/connect.php";
$id=$_POST['id'];
$psword=$_POST['psword'];
if($id=='admin'&&$psword=='admin')
{
    setcookie("userId",$id,time()+3600,'/');
    echo "<script>location='../sign.php'</script>";
}

//解密
$arr=str_split($psword);
$number=count($arr);

for ($j=0;$j<$number;$j++){
    $temp=ord($arr[$j])+3;
    $arr[$j]=chr($temp);

}
$arr=implode("",$arr);



$sql="select id,psword from userId where id='{$id}' and psword='{$arr}'";

$result=$conn->query($sql);
if($row = mysqli_fetch_assoc($result))
{
  setcookie("userId",$id,time()+3600,'/');
    echo "<script>location='../../common/index.html'</script>";
}
else
{

    echo "<script>alert('用户名或密码错误请重新输入')</script>";
    echo "<script>location='../login.php'</script>";
}


?>